package cn.yyt.yytravel.like.service;

import cn.yyt.yytravel.like.mapper.LikeMapper;
import cn.yyt.yytravel.like.pojo.query.LikeQuery;
import cn.yyt.yytravel.like.pojo.query.SearchQuery;
import cn.yyt.yytravel.like.pojo.vo.getSceneFollowVO;
import cn.yyt.yytravel.like.pojo.vo.getUserFollowVO;
import cn.yyt.yytravel.like.pojo.vo.LikeSceneVO;
import cn.yyt.yytravel.like.pojo.vo.LikeUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class LikeServiceImpl implements LikeService {
    @Autowired
    LikeMapper likeMapper;

    @Override
    public List<LikeUserVO> selectFollowUser(Long id) {
        List<LikeUserVO> list = likeMapper.selectFollowUser(id);
        return list;
    }

    @Override
    public List<LikeSceneVO> selectFollowScene(Long id) {
        List<LikeSceneVO> list = likeMapper.selectFollowScene(id);
        return list;
    }

    @Override
    public void deleteFollowUser(LikeQuery likeQuery) {
        likeMapper.deleteFollowUser(likeQuery);
    }

    @Override
    public void updateFollowUser(LikeQuery likeQuery) {
        likeMapper.updateFollowUser(likeQuery);
    }

    @Override
    public void deleteFollowScene(LikeQuery likeQuery) {
        likeMapper.deleteFollowScene(likeQuery);
    }

    @Override
    public void updateFollowScene(LikeQuery likeQuery) {
        likeMapper.updateFollowScene(likeQuery);
    }

    @Override
    public List<LikeUserVO> resetUserSearch(SearchQuery searchQuery) {
        List<LikeUserVO> list = likeMapper.resetUserSearch(searchQuery);
        return list;
    }

    @Override
    public List<LikeSceneVO> resetSceneSearch(SearchQuery searchQuery) {
        List<LikeSceneVO> list = likeMapper.resetSceneSearch(searchQuery);
        return list;
    }

    @Override
    public Boolean getUserFollow(LikeQuery likeQuery) {
        List<getUserFollowVO> list = likeMapper.getUserFollow(likeQuery);
        if (list == null || list.isEmpty()) {
            return false;
        }else {
            return true;
        }
    }

    @Override
    public Boolean getSceneFollow(LikeQuery likeQuery) {
        List<getSceneFollowVO> list = likeMapper.getSceneFollow(likeQuery);
        if (list == null || list.isEmpty()) {
            return false;
        }else {
            return true;
        }
    }

}
